<?php

    abstract class chouxiang{
        var $fisherNum;
        public function __construct($num){
            $this->fisherNum = $num;
        }

//        php不支持数组类型的const，所以要用静态属性
        public static $fish=['鲤鱼','草鱼','鲢鱼',];

        abstract public function fishing($fishNum);
        abstract public function getFish();

        public static function warning(){
            echo "你正在钓鱼！";
        }


    }

    echo '直接调用抽象类的静态属性：',PHP_EOL;
    chouxiang::warning();
    echo PHP_EOL;
    print_r(chouxiang::$fish);
    echo PHP_EOL;


//    继承抽象类
    class newFishing extends chouxiang{
        public function fishing($fishNum){
            echo parent::$fish[$fishNum];
        }

        public function getFish(){
            echo '你是钓手',$this->fisherNum,'，你钓到了：';
        }

        public function notice($x){
            parent::warning();
            $this->getFish();
            $this->fishing($x);
        }

    }

    $fisher1= new newFishing(1);
    $fisher1->notice(1);





?>